import urlparseimport stringclass StringSubstError:    passclass action:    def __init__(self, target):        self.target = target            def __call__(self,url,**namespace):        # raise exception if version < 2.4        if not hasattr(string,"Template"): # Python 2.4 or above            raise StringSubstError,"Unable to handle this syntax for " + \                "string substitution. Python version must be 2.4 or above"        # apply Python string substitution        abs_url = urlparse.urljoin(self.target.script_url,url)        target = self.target.url_to_file(abs_url)        templateDef = open(target.name).read()        data = string.Template(templateDef).substitute(namespace)        return data        